<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

class CreateCmsSlidesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('cms_slides')) {
            Schema::create('cms_slides', function (Blueprint $table) {
                $table->id();
                $table->string('name', 30)->default('')->comment('幻灯片分类名称');
                $table->string('remark')->nullable()->comment('备注');
                $table->enum('status', ['yes', 'no'])->default('yes')->comment('状态,yes:显示,no不显示');
                $table->softDeletes();
                $table->timestamps();
            });
            DB::statement("ALTER TABLE `cms_slides` comment '幻灯片表'");
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('cms_slides');
    }
}
